<?php


namespace App\Model;


/**
 * App\Model\OrderTransaction
 *
 * @property int $id
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property int $type 支付方式，1是微信支付，2是支付宝
 * @property float $total_fee 支付金额
 * @property string $pay_data 支付通知数据打包
 * @property string $transaction_id 支付方流水号
 * @property string $order_id_array 对应的订单表，多个以,号隔开
 * @property-read mixed $type_dec
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction whereOrderIdArray($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction wherePayData($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction whereTotalFee($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction whereTransactionId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\OrderTransaction whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class OrderTransaction extends Base
{

    protected $table='order_transaction';

    protected $fillable=['type','total_fee','pay_data','transaction_id','order_id_array'];

    protected $appends=['type_dec'];


    function getTypeDecAttribute()
    {

        $delivery_type=$this->attributes['type']??'';

        if(!$delivery_type) return $delivery_type;

        switch ($delivery_type){

            case '1':

                return '微信支付';

                break;

            case '2':

                return '支付宝';

                break;


        }


        return $delivery_type;
    }

}
